/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.regressao.linear.modelo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Rodrigo Moreira Alexandre
 * @author Fernando Aparecido Paulo
 */
@Entity
@Table(name = "eixo_x")
@NamedQueries({
    @NamedQuery(name = "EixoX.getAll", query = "SELECT e FROM EixoX e"),
        @NamedQuery(name = "EixoX.getMax", query = "SELECT MAX(e.codigo) FROM EixoX e")
})
public class EixoX implements Serializable, IModelo {

    @Id
    @Column(name = "cp_eixo_x")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer codigo;
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "eixoX", orphanRemoval = true)
    private List<ItemEixoX> itensX = new ArrayList<>();

    @Override
    public Integer getCodigo() {
        return codigo;
    }

    public List<ItemEixoX> getItensX() {
        return itensX;
    }

    public void setItensX(List<ItemEixoX> itensX) {
        this.itensX = itensX;
    }

    public void setCodigo(int codigo) {
        this.codigo = codigo;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 79 * hash + this.codigo;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final EixoX other = (EixoX) obj;
        if (this.codigo != other.codigo) {
            return false;
        }
        return true;
    }

    @Override
    public boolean isInativo() {
        return false;
    }

}
